<template>
  <div class="recommends">
    <div
      class="recommend-item"
      v-for="item in recommends.slice(0, 4)"
      :key="item.id"
    >
      <a href="">
        <img :src="item.cover_url" class="child_one" />
        <div>{{ item.title }}</div>
      </a>
    </div>
  </div>
</template>

<script lang="ts">
import { onMounted, reactive, ref } from "vue";
import NavBar from "../../../components/common/navbar/NavBar";
import { getHomeAllData } from "../../../network/home";
export default {
  props: {
    // ⚪️ 7、 接收父组件传过来的数据
    recommends: {
      type: Array,
      defaults() {
        // 给默认值，这样没传数据也可以在页面进行遍历
        return [];
      },
    },
  },
  name: "App",
  components: { NavBar },
  props: {
    recommends: {
      type: Array,
    },
  },
  setup() {},
};
</script>
<style lang="scss" scoped>
.recommends {
  display: flex;
  width: 100%;
  text-align: center;
  padding: 15px 0 30px;
  border-bottom: 8px solid #eee;
  font-size: 12px;
  .recommend-item {
    flex: 1; // 每个选项各点一份
    img {
      width: 70px;
      height: 70px;
      margin-bottom: 10px;
    }
  }
}
</style>
